﻿using System;
using System.Windows.Ria.ApplicationServices;
using SoftSource.Reactive;
using SoftSource.Ria;

namespace SoftSource.Timecard
{
    public sealed partial class WebContext : ISerialWebContextBase
    {
        private readonly ObservableQueue<object> queue = new ObservableQueue<object>();

        public IObservable<LoadUserOperation> LoadUser()
        {
            return this.queue.QueueTypedObservable(this.Authentication.WhenLoadUser());
        }

        public IObservable<SaveUserOperation> SaveUser()
        {
            return this.queue.QueueTypedObservable(this.Authentication.WhenSaveUser());
        }

        public IObservable<LoginOperation> Login(LoginParameters parameters)
        {
            return this.queue.QueueTypedObservable(this.Authentication.WhenLogin(parameters));
        }

        public IObservable<LogoutOperation> Logout()
        {
            return this.queue.QueueTypedObservable(this.Authentication.WhenLogout());
        }
    }
}
